package action;


import java.util.Iterator;
import java.util.List;

import org.apache.struts2.ServletActionContext;
import org.hibernate.Session;

import po.*;

import bean.EmailBean;
import bo.HibernateSessionFactory;

import com.opensymphony.xwork2.ActionSupport;

public class EmailDeleteC extends ActionSupport{
	private int id;
	
	public String execute(){
		
		

			

			Session session = HibernateSessionFactory.getSession();
		
				Email e = new EmailDAO().findById(id);
				String a = e.getAcceptflag();
				String b = e.getSendflag();

				if(a.equalsIgnoreCase("3")){
					e.setAcceptflag("5");
				}
				if(b.equalsIgnoreCase("3")){
					e.setSendflag("5");
				}
			
			session.beginTransaction().commit();
				

			return "Deleted";
		}
		

		
	

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}
	
}
